<?php
class ClassificationCompany extends AppModel {
	var $name = 'ClassificationCompany';
	var $displayField = 'id';
	var $validate = array(
		'company_id' => array(
			'numeric' => array(
				'rule' => array('numeric'),
				
			),
		),
		'classification_id' => array(
			'numeric' => array(
				'rule' => array('numeric'),
				
			),
		),
	);
	//The Associations below have been created with all possible keys, those that are not needed can be removed

	var $belongsTo = array(
		'Company' => array(
			'className' => 'Company',
			'foreignKey' => 'company_id',
		),
		'Classification' => array(
			'className' => 'Classification',
			'foreignKey' => 'classification_id',
			
		)
	);

        public function addClassificationCompany($companyId,  $classifyId){
            $data['ClassificationCompany']['company_id'] = $companyId;
            $data['ClassificationCompany']['classification_id'] = $classifyId;
            $this->create();
            if($this->save($data)){
                return true;
            }else{
                return false;
            }
        }

        public function getByCompany($companId){
              return $this->find('first', array('conditions' => array('ClassificationCompany.company_id' => $companId), 'recursive' => -1));
        }
}
?>